CC = gcc
LD = ld
AS = as

CFLAGS = -g -Wall

SRCDIR = src
OBJDIR = obj

OBJS = $(OBJDIR)/ctest.o $(OBJDIR)/ia32.o

TARGET = ctest
TARGET_ELF = $(OBJDIR)/$(TARGET).elf
TARGET_BIN = $(OBJDIR)/$(TARGET).bin
TARGET_DIS = $(OBJDIR)/$(TARGET).dis


#all: $(TARGET_ELF) $(TARGET_BIN) $(TARGET_DIS)
all: $(TARGET_ELF)


$(TARGET_ELF): $(OBJS)
	$(CC) -o $@ $^

.SUFFIX: .c .S

$(OBJDIR)/%.o:$(SRCDIR)/%.c
	$(CC) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/%.o:$(SRCDIR)/%.S
	$(CC) $(CFLAGS) -c -o $@ $<


.PHONY: clean

clean:
	-rm $(TARGET_ELF) $(TARGET_BIN) $(TARGET_DIS) $(OBJS)

